<?php
	include("includes/functions.php");
	if($_REQUEST['command']=='add' && $_REQUEST['productid']>0){
		$pid=$_REQUEST['productid'];
		addtocart($pid,1);
		echo "<script>window.location='index.php?page=shoppingcart'</script>";
		exit();
	}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<script language="javascript">
	function addtocart(pid){
		document.form1.productid.value=pid;
		document.form1.command.value='add';
		document.form1.submit();
	}
</script>
<body>
	<table border="0" cellpadding="0" cellspacing="0" width="100%">
		<tr>
			<?php
				$id = $_GET['id1'];
				$query = "select * from groupcategories where id=$id";
				$result = mysql_query($query);
				while($row = mysql_fetch_array($result)){?>
				<td class="sp_home_title" width="100%">
					<?php //echo $row['groupName'];?>
				</td>
				<?php
				}
				?>
		</tr>
	</table>
	<?php include("menucontenttop.php");?>
	<table cellspacing="2" cellpadding="0"  class="sp_home" align="left">
		<tr>
			<?php
			$id = $_GET['id1'];
			$query = "select * from productdetails where groupID=$id";
			$result = mysql_query($query);
			$a=1;
			while($row = mysql_fetch_array($result)){?>
			<td height="100%" align="center" valign="top">
				<div class="sp_moi_content">
				
				<div class="khung_sp_tc_main">
					<table border="0" cellspacing="0" cellpadding="0" width="100%">
						<tr>
							<td class="content-box" width="100%">
								<div align="left" ><a href="index.php?page=listviewproductDetail&id=<?php echo $row['id'];?>" ><?php echo $row['productname'];?></a></div>
							</td>
						</tr>
						<tr>
							<td class="content-second" width="100%"><?php echo $row['productDetail'];?></td>
						</tr>
						<tr>
							<td class="date_created">Ngày tạo : <?php $ngay = date('d/m/Y', $row['dateCreated']); echo $ngay;?>  -  <span class="view-detail-download"><a href="index.php?page=listviewproductDetail&id=<?php echo $row['id'];?>">Xem chi tiết tải về</a></span> - Lượt tải về : <?php echo $row['productView'];?></td>
						</tr>
						<tr>
							<td align="center" valign="bottom" width="100%">
							
							<!--<div class="luotxem">Lượt xem : <?php echo $row['productView'];?></div>-->
							</td>
						</tr>
						<tr>
							<td align="center" valign="bottom" width="100%" height="10%">
								 <!--<input type="button" value="Mua hàng" onclick="addtocart(<?=$row['id']?>)" />-->
							</td>
						</tr>
					</table>
				</div>
				</div>
			</td>
			<div style="display:none;" id="<?php echo $row['id'];?>"><?php echo $row['productDetail'];?></div>
			 <?php
			if($a%1==0){
				echo "<tr></tr>";	
			}
			$a=$a+1;
		   }
			?>
		</tr>
	</table>
</body>
</html>